package org.xin.security.pojo.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.xin.framework.base.pojo.entity.IBaseSimpleEntity;
import org.xin.security.constant.SecurityConstant;

import java.io.Serializable;
import java.util.List;

/**
* <p>
    * 系统模块-用户安全表
    * </p>
*
* @author: xin
* @date: Create in 2021-09-29
*/

@ApiModel(description = "系统模块-用户安全Entity")
@Getter
@Setter
@ToString(callSuper = true)
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sys_user_security")
public class SysUserSecurity extends IBaseSimpleEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    private String sysUserId;

    @JsonIgnore
    private String openId;

    private String sysDeptId;

    @JsonIgnore
    private String password;

    @JsonIgnore
    private String salt;

    private String username;

    private String sysRoleId;

    /** 删除标志（0代表存在 2代表删除） */
    private Boolean isDelete;

    private String userStatus;

    private String loginIp;

    private String lastLoginTime;

    public boolean isAdmin() {
        return isAdmin(this.sysUserId);
    }

    public static boolean isAdmin(String id) {
        return SecurityConstant.ADMIN_ID.equals(id);
    }
}
